-> root -> system -> ::system::editors
Informations about various system editors...
Notes on this page:

Useful VIM keys
[3]

gd

When the cursor is on a local variable, it will jump to its own declaration. It will first search the local scope, and then the rest of the file.

gD

When the cursor is on a global variable, it will jump to its own declaration. Starts searching from line 1 of the file.

gf

Opens the file whose name is under the cursor.

[i

Displays the first line that contains the word under the cursor. This is useful to look at the declarations of functions or variables.

[I

Display all lines that contain the word under the cursor. This is useful to see where a local variable is used and how.

=

Indents the highlighted block, following the rules indicated by the file type.

}

Goes to the end of the current block.

L

To the end of the current screen.

*, #

Search forward/backward for the word under the cursor.

M

Go to the middle of the screen.

set fp?

Prints the name of the program used to format the data.

set ft?

Shows the file type of the open buffer.

gUiw, viwU

Upper cases/lower case the word under the cursor.

set encoding=utf8

Tells vim that the file is utf8 encoded.

ctrl+e, ctrl+y

Moves the current file one line upward or downward.

diffthis

By giving this command in two different buffers, the differences between the buffers are highlighted and colored. It is equivalent to running vimdiff.

This note is available in the following categories:

VIM modelines, comments instructing VI
[12]

Ok, to set certaion options automatically for a given file, you can simply use something like:
 vi:ts=2:
where vi: and the final : are mandatory, while ft=php is just a simple option that instructs vi about the format of the file being edited.

Usually, this "string" is put as a "comment" inside the file being edited. In some programming languages, the above option would look something like:
  in Perl:
  # vi:ts=2:
  in PHP:
  // vi:ts=2:
 
Watch out, however, that if you want to put "other characters" after the special command, you need to specify the "set" command, with something like:
  in PHP:
  /* vi:set ts=2: */
  enclosing the command in square brackets:
  # [ vi:set ts=2: ]
 

To have complete help about the above options, you can use ":help vi:" or ":help modeline".

This note is available in the following categories:
Generated by CRON on 2012/02/14 at 06:26:35.